import { BaseWindow } from "../../../component/window/BaseWindow";
import { ILayer } from "../../../mvc/interfaces/ILayer";
import { DataProvider } from "../../../../fl/data/DataProvider";
import { ObjCreate } from "../common/ObjCreate";
import { TestPVPServerListRenderer } from "./TestPVPServerListRenderer";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { DataEvent } from "../../events/DataEvent";
import { EventName } from "../../mvc/EventName";
import { GButton } from "../../../../com/mui/controls/GButton";
import { GTileList } from "../../../../com/mui/controls/GTileList";
//class TestPVPInterfacePanel
    
    export  class TestPVPInterfacePanel extends BaseWindow
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            this._serverListDp = new DataProvider();
            this.setSize(550, 370);
            this.titleHeight = 25;
            this.title = "跨服pvp测试";
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            ObjCreate.createBg(20, 40, 510, 310, this);
            this._getServerListBtn = ObjCreate.createGButton("获取服务器列表", 30, 50, 100, 26, this);
            this._getServerListBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onGetServerListBtnClickHandler);
            this._serverList = ObjCreate.createTileList(30, 80, 500, 260, this);
            this._serverList.columnWidth = 480;
            this._serverList.rowHeight = 30;
            this._serverList.setStyle("cellRenderer", TestPVPServerListRenderer);
            return;
        }

        /* internal  */onGetServerListBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.CrossPVP_getServerList));
            return;
        }

        public updateCountryList(arg1: Array<any>): void
        {
            this._serverListDp.removeAll();
            this._serverListDp.addItems(arg1);
            this._serverList.dataProvider = this._serverListDp;
            return;
        }

        /* internal */ /* var */_getServerListBtn: GButton;

        /* internal */ /* var */_serverListDp: DataProvider;

        /* internal */ /* var */_serverList: GTileList;
    }
